package com.jet.goods.gate;

import com.jet.core.result.ResultJson;
import com.jet.goods.domain.vo.UnitVo;
import com.jet.goods.service.IGoodsUnitService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dcl
 * @date 2023-02-24 13:05:56
 */
@RestController
@RequestMapping("/gate/goods/unit")
public class GateUnitController {

    private final IGoodsUnitService goodsUnitService;

    public GateUnitController(IGoodsUnitService goodsUnitService) {
        this.goodsUnitService = goodsUnitService;
    }

    @GetMapping("/list")
    public ResultJson<List<UnitVo>> list(@RequestHeader long merchantNo,
                                         @RequestHeader long storeNo,
                                         @RequestHeader String accountId) {
        List<UnitVo> list = goodsUnitService.findAll(merchantNo);
        return ResultJson.ok(list);
    }
}
